﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Xww.Task {

    public class ProgressStatus : EventArgs {
        public int TotalSteps { get; internal set; }
        public int CurrentStep { get; set; }
        public ErrorStatus ErrorState { get; internal set; }
        public Exception Error { get; internal set; }
        public string StatusInformation { get; set; }
        public bool IsNewStep { get; set; }

        public ProgressStatus()
            : this(0, "") {
        }
        public ProgressStatus(int total, string status)
            : base() {
            TotalSteps = total;
            CurrentStep = 1;
            ErrorState = ErrorStatus.Normal;
            StatusInformation = status;
            IsNewStep = true;
        }
        public void ChangeStep(string info) {
            StatusInformation = info;
            IsNewStep = true;
        }
        public void ProgressOneStep() {
            ++CurrentStep;
            IsNewStep = false;
        }
    }

    public enum ErrorStatus {
        Normal=0, Warn, Error
    }
}
